package com.coderside.fragment.arithmetic;

public class SortTest {

	public static void main(String[] args) {

		int[] arr2 = createList();
		int[] arr = { 784, 438, 402, 914, 887, 164 };
		int[] arr3 = { 784, 438, 402, 914, 887, 164, 204, 165, 786, 276, 446,
				986, 234, 266, 135, 654, 235, 628, 867, 332, 2, 84, 578, 498,
				699, 784, 299, 296, 555, 594, 635, 706, 133, 656, 396, 143,
				113, 80, 511, 67, 934, 66, 909, 206, 35, 707, 502, 280, 247,
				474, 838, 451, 88, 681, 211, 305, 314, 241, 272, 855, 140, 694,
				233, 920, 916, 751, 790, 228, 933, 624, 794, 789, 217, 980,
				518, 389, 877, 677, 79, 533, 553, 340, 231, 832, 39, 453, 247,
				584, 967, 879, 86, 279, 739, 618, 357, 850, 549, 178, 869, 762,
				451, 161, 711, 441, 870, 511, 863, 133, 914, 427, 336, 998, 69,
				116, 694, 147, 646, 391, 604, 371, 395, 651, 778, 498, 271,
				878, 218, 688, 241, 165, 233, 479, 346, 684, 70, 69, 997, 177,
				350, 138, 611, 813, 685, 511, 241, 677, 21, 80, 834, 274, 263,
				712, 92, 150, 696, 318, 686, 158, 541, 854, 772, 944, 773, 807,
				305, 943, 965, 614, 665, 563, 496, 562, 494, 236, 928, 924,
				441, 728, 761, 501, 721, 417, 30, 247, 32, 272, 413, 408, 337,
				878, 631, 390, 522, 217, 908, 666, 704, 823, 166, 124, 243,
				601, 471, 644, 150, 839, 959, 131, 626, 902, 75, 894, 928, 684,
				545, 45, 628, 122, 895, 541, 603, 11, 709, 606, 752, 885, 67,
				523, 547, 977, 751, 207, 993, 111, 895, 564, 468, 943, 715,
				332, 241, 111, 839, 34, 136, 735, 551, 680, 952, 180, 924, 82,
				759, 153, 477, 976, 126, 22, 415, 691, 649, 703, 3, 742, 912,
				585, 879, 557, 140, 747, 372, 559, 368, 144, 4, 913, 901, 539,
				400, 575, 198, 709, 767, 727, 101, 838, 950, 280, 496, 93, 838,
				886, 69, 75, 538, 835, 822, 222, 322, 278, 407, 263, 803, 444,
				134, 513, 200, 916, 709, 121, 822, 573, 400, 416, 89, 495, 316,
				106, 529, 7, 927, 434, 175, 21, 796, 324, 700, 29, 710, 217,
				451, 417, 59, 515, 268, 239, 360, 557, 595, 251, 285, 575, 933,
				780, 398, 367, 128, 964, 104, 323, 325, 992, 974, 971, 699,
				263, 685, 467, 194, 761, 322, 295, 619, 563, 676, 975, 373, 88,
				470, 786, 998, 620, 158, 310, 501, 642, 50, 144, 112, 760, 52,
				244, 738, 317, 215, 197, 847, 335, 638, 186, 977, 70, 997, 497,
				346, 316, 129, 260, 267, 548, 639, 479, 220, 152, 465, 563,
				454, 280, 705, 258, 928, 300, 754, 332, 277, 455, 25, 395, 202,
				66, 43, 958, 393, 556, 768, 220, 615, 656, 329, 73, 88, 357,
				198, 539, 675, 577, 13, 149, 649, 72, 909, 808, 40, 778, 185,
				327, 637, 665, 604, 107, 725, 191, 453, 437, 562, 584, 692,
				495, 413, 552, 220, 396, 672, 455, 288, 584, 242, 651, 588,
				466, 880, 490, 382, 396, 660, 405, 318, 64, 29, 639, 260, 865,
				237, 408, 526, 82, 18, 750, 450, 534, 530, 830, 26, 930, 496,
				259, 763, 300, 366, 835, 514, 753, 143, 176, 223, 286, 162,
				901, 6, 534, 748, 394, 932, 161, 150, 674, 208, 36, 596, 579,
				180, 504, 598, 284, 753, 790, 880, 176, 345, 39, 419, 223, 466,
				592, 146, 281, 385, 813, 761, 227, 92, 211, 2, 422, 973, 668,
				447, 762, 164, 259, 571, 492, 575, 575, 387, 44, 931, 446, 438,
				380, 23, 667, 305, 716, 525, 665, 76, 47, 384, 48, 419, 584,
				792, 611, 987, 84, 174, 719, 915, 57, 469, 905, 43, 9, 218,
				198, 349, 189, 613, 918, 780, 829, 710, 663, 315, 448, 488,
				756, 609, 635, 269, 707, 24, 643, 310, 114, 211, 253, 45, 26,
				627, 614, 535, 953, 578, 206, 177, 642, 411, 608, 622, 213,
				457, 536, 146, 468, 235, 467, 433, 9, 170, 216, 836, 312, 806,
				43, 712, 31, 71, 212, 344, 658, 670, 455, 304, 88, 93, 430,
				843, 786, 21, 119, 48, 23, 166, 91, 49, 81, 701, 659, 520, 431,
				453, 298, 93, 604, 4, 121, 48, 918, 676, 800, 851, 260, 132,
				123, 674, 828, 995, 246, 21, 148, 439, 832, 996, 662, 199, 431,
				521, 913, 808, 924, 60, 647, 176, 312, 981, 201, 786, 910, 727,
				150, 924, 807, 402, 530, 329, 481, 190, 907, 569, 657, 275,
				174, 285, 759, 581, 266, 141, 858, 700, 880, 965, 604, 816,
				906, 99, 441, 330, 512, 419, 373, 133, 729, 827, 616, 164, 941,
				287, 771, 978, 901, 613, 552, 512, 775, 328, 685, 178, 227,
				824, 313, 664, 756, 998, 160, 568, 335, 283, 710, 86, 897, 687,
				893, 503, 362, 86, 104, 164, 715, 475, 905, 923, 114, 332, 421,
				827, 114, 534, 278, 915, 891, 523, 894, 583, 767, 515, 98, 921,
				443, 606, 312, 768, 78, 560, 12, 45, 769, 913, 785, 65, 48,
				787, 26, 113, 702, 467, 308, 595, 637, 357, 453, 423, 496, 409,
				629, 124, 445, 502, 148, 364, 879, 524, 195, 189, 799, 115,
				425, 314, 258, 114, 204, 200, 581, 771, 306, 517, 55, 691, 23,
				809, 365, 286, 990, 835, 371, 250, 494, 102, 723, 188, 685,
				579, 433, 83, 894, 420, 742, 700, 210, 830, 535, 404, 586, 846,
				125, 110, 997, 922, 427, 240, 597, 670, 428, 636, 393, 26, 371,
				357, 683, 387, 284, 147, 413, 4, 294, 183, 615, 5, 680, 358,
				327, 951, 778, 992, 727, 751, 635, 358, 733, 116, 818, 806,
				992, 433, 849, 595, 8, 119, 574, 789, 134, 53, 161, 656, 287,
				639, 552, 91, 564, 430, 897, 493, 351, 997, 951, 399, 145, 917,
				435, 917, 84, 326, 100, 670, 57, 492, 584, 513, 388, 226, 221,
				800, 292, 785, 585, 300, 691, 105, 956, 201, 537, 833, 841,
				790, 462, 622, 371, 537, 470, 624, 688, 270, 356, 898, 397, 93,
				738, 723, 805, 452, 902, 445, 911, 540, 134, 529, 83, 831, 866,
				959, 917, 51, 745, 976, 42, 386, 688, 433, 529, 32, 94, 713,
				121, 463, 643, 236, 720, 955, 537 };
		long a = System.nanoTime();
		QuickSort.quickSort(arr, 0, arr.length - 1); // (数据量 纳秒 )1000 323382
		// 7 3539
		// sort1(arr, 0, arr.length); // (数据量 纳秒) 1000 662775 7 3608
		long b = System.nanoTime();
		System.out.println(b - a);

	}

	private static int[] createList() {
		int i = 0;
		int size = 1000;
		int[] arr = new int[size];
		while (i < size) {
			arr[i] = (int) (Math.random() * size);
			i++;
		}
		return arr;
	}
}
